﻿@model MyProj.MVCProj3.Model.UserInfo

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>Edit</title>
    <script type="text/javascript">
        //由父容器来调用提交表单数据的方法
        function submitEditFrm() {
            $("#ajaxUserEditFrm").submit();
        }

        //修改成功后执行此方法    
        function afterEdit() {
            //调用父容器的 关闭对话框
            window.parent.afterEdit();
        }
    </script>
</head>
<body>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    @*需要引入jquery.validate.min.js*@
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>

     @using (Ajax.BeginForm("Edit","UserInfo",new {},
                new AjaxOptions() { HttpMethod = "post", OnSuccess = "afterEdit", UpdateTargetId = "IsEditOK_hidden" }, new { id = "ajaxUserEditFrm" }))
                {

            <h2>编辑用户信息</h2>
    
            @Html.HiddenFor(model => model.ID)
            <span>用户名：</span><span>@Model.UserName</span>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Age)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Age)
                @Html.ValidationMessageFor(model => model.Age)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.NickName)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.NickName)
                @Html.ValidationMessageFor(model => model.NickName)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Email)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Email)
                @Html.ValidationMessageFor(model => model.Email)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Phone)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Phone)
                @Html.ValidationMessageFor(model => model.Phone)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.Address)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Address)
                @Html.ValidationMessageFor(model => model.Address)
            </div>
    
            <div class="editor-label">
                @Html.LabelFor(model => model.UPwd)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.UPwd)
                @Html.ValidationMessageFor(model => model.UPwd)
            </div>
            
            <input type="hidden" id="IsEditOK_hidden" value="false"/>
        }
        
</body>
</html>
